package com.tang.designpattern.singleton;

/**
 * @author tlm
 * @version 1.0
 * @date 2020/4/30 18:04
 * 饿汉式改进
 * 静态内部类实现
 */
public class SingletonDemo04 {
    //1.私有化构造器
    private SingletonDemo04(){

    }
    //2.静态内部类实现
    private static class InnerClass{
        private static final SingletonDemo04 INSTANCE = new SingletonDemo04();
    }
    public static SingletonDemo04 getInstance(){
        return InnerClass.INSTANCE;
    }

    //反射机制：可以破坏以上四种单例
}
